<?php

namespace app\queue\stomp;

use app\queue\BaseConsumer;
use common\service\OrderService;
use Throwable;

class UpdateOrderFileStatusConsumer extends BaseConsumer
{

    // 要消费的队列名
    public $queue = 'update_order_file_status';

    // 连接名，对应 config/redis_queue.php 里的连接`
    public $connection = 'default';

    /**
     * 任务排期
     * @param $data
     * @throws Throwable
     */
    public function doConsume($data)
    {
        try {
            $orderService = OrderService::getInstance();
            $orderService->updateOrderFileStatus($data['id']);
        } catch (Throwable $e) {
            trace(format_exception_info($e), 'ERR');
        }
    }
}
